{% extends "cmdb/index.html" %}
{% block title %}游戏操作{% endblock %}
{% block style %}
    <link type="text/css" rel="stylesheet" href="/static/css/ui.jqgrid.css">
    <link rel="stylesheet" type="text/css" media="screen" href="/static/css/jquery-ui-1.7.1.custom.css" />
{% endblock %}
{% block breadcrumb  %}
    <ul class="breadcrumb">
                            <li>
                                <i class="ace-icon fa fa-home home-icon"></i>
                                <a href="#">Home</a>
                            </li>
                            <li>
                                <i class="ace-icon fa fa-home home-icon"></i>
                                <a href="#">游戏管理</a>
                            </li>
                            <li class="active">游戏管理</li>
                        </ul><!-- /.breadcrumb -->
{% endblock %}
{% block page-header %}
<div class="page-header">
    <h1>
        Dashboard
        <small>
            <i class="ace-icon fa fa-angle-double-right"></i>
        游戏管理 &amp; 游戏操作
        </small>
        </h1>
</div><!-- /.page-header -->
    <div id="loading"></div>
{% endblock %}
{% block content %}
    {% include "game/game_public.html"  %}
{% endblock %}
 {% block scripts %}
      {% include "game/game_public_js.html"  %}
{% endblock %}


{#{% block content %}#}
{#<div class="dropdown">#}
{#    <div class="btn-group">#}
{#    <button type="button" class="btn dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown">游戏信息相关#}
{#        <span class="caret"></span>#}
{#    </button>#}
{#    <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">#}
{#        <li role="presentation">#}
{#           <a role="menuitem" tabindex="-1" href="#" onclick="all_func('cat_game_ver','查看版本')">查看游戏版本</a>#}
{#        </li>#}
{#        <li role="presentation">#}
{#            <a role="menuitem" tabindex="-1" href="#"></a>#}
{#        </li>#}
{#        <li role="presentation">#}
{#            <a role="menuitem" tabindex="-1" href="#" onclick="cat_game_conf()">查看游戏配置文件</a>#}
{#        </li>#}
{#        <li role="presentation">#}
{#            <a role="menuitem" tabindex="-1" href="#" onclick="all_func('cat_game_status','查看游戏进程状态')">查看游戏进程状态</a>#}
{#        </li>#}
{##}
{##}
{#    </ul>#}
{#        </div>&nbsp;&nbsp;#}
{#    <div class="btn-group">#}
{#   <button type="button" class="btn dropdown-toggle" id="dropdownMenu2" data-toggle="dropdown">游戏更新相关#}
{#        <span class="caret"></span>#}
{#    </button>#}
{#        <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">#}
{#        <li role="presentation">#}
{#           <a role="menuitem" tabindex="-1" href="#" onclick="all_func('update_game','更新游戏')">更新游戏</a>#}
{#        </li>#}
{#        <li role="presentation">#}
{#            <a role="menuitem" tabindex="-1" href="#" onclick="all_func('update_and_restart_game','更新并重启游戏')">更新并重启游戏</a>#}
{#        </li>#}
{#        <li role="presentation">#}
{#            <a role="menuitem" tabindex="-1" href="#" onclick="">更新游戏配置</a>#}
{#        </li>#}
{#        <li role="presentation">#}
{#            <a role="menuitem" tabindex="-1" href="#" onclick="">更新单个文件</a>#}
{#        </li>#}
{##}
{#    </ul>#}
{#    </div>#}
{#    <div class="btn-group">#}
{#   <button type="button" class="btn dropdown-toggle" id="dropdownMenu2" data-toggle="dropdown">游戏安装/清档#}
{#        <span class="caret"></span>#}
{#    </button>#}
{#        <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">#}
{#        <li role="presentation">#}
{#           <a role="menuitem" tabindex="-1" href="#" onclick="all_func('one_key_install_game','一键安装游戏')">一键安装游戏</a>#}
{#        </li>#}
{#        <li role="presentation">#}
{#            <a role="menuitem" tabindex="-1" href="#"></a>#}
{#        </li>#}
{#        <li role="presentation">#}
{#            <a role="menuitem" tabindex="-1" href="#" onclick="">一键清档</a>#}
{#        </li>#}
{##}
{##}
{#    </ul>#}
{#    </div>&nbsp;&nbsp;#}
{#<div class="btn-group">#}
{#   <button type="button" class="btn dropdown-toggle" id="dropdownMenu2" data-toggle="dropdown">热更新相关#}
{#        <span class="caret"></span>#}
{#    </button>#}
{#        <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">#}
{#        <li role="presentation">#}
{#           <a role="menuitem" tabindex="-1" href="#" onclick="">上传更新包</a>#}
{#        </li>#}
{#        <li role="presentation">#}
{#            <a role="menuitem" tabindex="-1" href="#"></a>#}
{#        </li>#}
{#        <li role="presentation">#}
{#            <a role="menuitem" tabindex="-1" href="#" onclick="">reload 进程相关</a>#}
{#        </li>#}
{##}
{##}
{#    </ul>#}
{#    </div>#}
{#    <div class="btn-group">#}
{#   <button type="button" class="btn dropdown-toggle" id="dropdownMenu2" data-toggle="dropdown">游戏启动/停止相关#}
{#        <span class="caret"></span>#}
{#    </button>#}
{#        <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">#}
{#        <li role="presentation">#}
{#           <a role="menuitem" tabindex="-1" href="#" onclick="all_func('stop_game','停止游戏')">停止游戏</a>#}
{#        </li>#}
{#            <li role="presentation">#}
{#           <a role="menuitem" tabindex="-1" href="#" onclick="all_func('start_game','启动游戏')">启动游戏</a>#}
{#        </li>#}
{#            <li role="presentation">#}
{#           <a role="menuitem" tabindex="-1" href="#" onclick="all_func('restart_game','重启游戏')">重启游戏</a>#}
{#        </li>#}
{##}
{##}
{##}
{#    </ul>#}
{#    </div>#}
{##}
{##}
{#</div>#}
{#<hr>#}
{#{% include "game/search_form.html"  %}#}
{#   <div id="mytable">#}
{#     <table class="table table-striped" id="gridtable" width="100%" border="1" cellspacing="0" >#}
{#        <thead>#}
{#        <tr>#}
{#            <th><input type="checkbox" name="check" id="all"/> </th>#}
{#            <th>ID</th>#}
{#            <th>游戏名</th>#}
{#            <th>服务器</th>#}
{#            <th>game_id</th>#}
{#            <th>用户名</th>#}
{#            <th>Result</th>#}
{#        </tr>#}
{#        </thead>#}
{#        {% for i in posts  %}#}
{#            <tr>#}
{#            <td width="5%"><input   type="checkbox" name="check_box" value="{{ i.id }}" /> </td>#}
{#            <td width="5%">{{ i.id }}</td>#}
{#            <td width="10%" class="success" >{{ i.name }}</td>#}
{#                <td width="10%" class="success" >{{ i.server }}</td>#}
{#            <td width="10%" class="active" >{{ i.game_id }}</td>#}
{#            <td width="10%" class="active" >{{ i.game_user }}</td>#}
{#            <td width="55%"></td>#}
{##}
{#            </tr>#}
{#        {% endfor %}#}
{#    </table>#}
{#   </div>#}
{#   <hr>    #}
{#     <div class="text-center">#}
{#    <label for="select">每页数据条数:</label>#}
{#    <select  id="mySelect">#}
{#        <option>0</option>#}
{#        <option selected="selected">10</option>#}
{#        <option>20</option>#}
{#        <option>30</option>#}
{#    </select>&nbsp;&nbsp;&nbsp;&nbsp;#}
{#    #}
{#    #}
{#    <div class="text-right">#}
{#    <ul class="pagination pagination-lg">#}
{#        <li class="disabled"><a href="#">&laquo;</a></li>#}
{#        {% for var in pagelist %}#}
{#            {% ifequal var curpage  %}#}
{#            <li class="active"><a href="{% url 'game_list' %}?curpage={{var}}&allpage={{allpage}}"> {{var}}</a></li>#}
{##}
{#            {% else %}#}
{#                <li><a href="{% url 'game_list' %}?curpage={{var}}&allpage={{allpage}}">{{var}}</a></li>#}
{#                {% endifequal %}#}
{#        {% endfor %}#}
{#    <li ><a href="#">&raquo;</a></li>#}
{#    </ul>#}
{#    </div>#}
{#    </div>#}
{#    <hr>#}
{#    <!--jqGrid 浏览导航栏所在-->#}
{#<p style="display:none">默认隐藏</p>#}
{#<!-- 模态框（Modal） -->#}
{#<div class="modal fade" id="mymodal"  >#}
{#    <div class="modal-dialog" style="width:520px;">#}
{#        <div class="modal-content">#}
{#            <p><button class="close" type="button" data-dismiss="modal">×</button></p>#}
{#                <hr />#}
{#                <p id="label_for_edit"  name="label_modal" class="text-center">aaaa</p>#}
{#                <!-- 模态弹出窗内容 -->#}
{#         <!-- <div class="modal-body">#}
{#            <textarea rows="2" cols="50">在这里输入回复</textarea>#}
{#          #}
{#         </div> -->#}
{#         <form id="myformid"  class="form-horizontal" method="POST" role="form"  onSubmit="return false;">#}
{#          <input type="hidden" name="csrfmiddlewaretoken" value="{{csrf_token}}">#}
{#          <input type="hidden" name="id" value="">#}
{#        {% for field in form %}        #}
{#          <div class="form-group"></div>#}
{#          <label for={{ field.label }} class="col-sm-3 control-label">{{ field.label }}</label>#}
{#          <div class="col-sm-8">{{ field }} </div>#}
{#         {{ field.errors }}#}
{#     {% endfor %}#}
{#        <div class="form-group">#}
{#                            <div class="col-sm-offset-2 col-sm-10">#}
{##}
{#                            <button type="submit" class="btn btn-success" onclick="postform()">确定</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#}
{#                            <button  id="btn2" type="button" class="btn btn-primary"   data-dismiss="modal">关闭</button>#}
{#                        </div>#}
{#                        </div>#}
{#        </form>  #}
{#         </div>#}
{#      </div><!-- /.modal-content -->#}
{#</div><!-- /.modal -->#}
{##}
{#{% endblock %}#}
{##}
{#    {% block scripts %}#}
{#       #}
{#    <script type="text/javascript">#}
{##}
{##}
{#    function postform(){#}
{#       var baseurl="{% url "game_list" %}?&r="+Math.random();#}
{#       option=getCookie('option');#}
{#       var url = baseurl+"&option="+option;#}
{#       delCookie('option');#}
{#       $.ajax({#}
{#                cache: false,#}
{#                type: "POST",#}
{#                url:url,#}
{#                data:$('#myformid').serialize(),// 你的formid#}
{#                async: false,#}
{#                dataType: "json",#}
{#                error: function(request) {#}
{#                    alert("Connection error");#}
{#                },#}
{#                success: function(data) {#}
{#                    alert(data.msg);#}
{#                    delCookie('pageper');#}
{##}
{#                    $("#mymodal").modal('hide');#}
{#                    var url="{% url "game_list" %}?&r="+Math.random();#}
{#                    window.location.href=url;#}
{#                 }#}
{#            }); #}
{#    }#}
{##}
{##}
{#    function cat_game_conf(){#}
{#        var len = $("input:checkbox:checked").length;#}
{#        if (len>1){#}
{#            alert("一次只能编辑一个");#}
{#            return false;#}
{#        }#}
{#        else if  (len==0){#}
{#            alert("你还没有选中");#}
{#            return false;#}
{#        }#}
{#        var chk_value =[];#}
{#        $('input[name="check_box"]:checked').each(function(){#}
{#        chk_value.push($(this).val());#}
{#        });#}
{#        var server_id=chk_value[0];#}
{#        func="cat_game_conf";#}
{#        var url= "{% url "game_operation" %}?option="+func+"&r="+Math.random();#}
{#        postdata={serverid:server_id,csrfmiddlewaretoken:"{{csrf_token}}"};#}
{#        ajax_get(url,server_id,1,6,postdata,"查看游戏配置文件");#}
{#    }#}
{##}
{##}
{#//ajax_get(url,sid,isresult,tdlocation,postdata)#}
{##}
{#function all_func(func,func_name) {#}
{#       var func=func;#}
{#       action=func_name;#}
{#       var len = $("input:checkbox:checked").length;#}
{#       if  (len==0){#}
{#          alert("你还没有选中"); #}
{#          return false;#}
{#       }#}
{#       console.log(action);#}
{#       var chk_value =[];#}
{#       $('input[name="check_box"]:checked').each(function(){#}
{#       chk_value.push($(this).val());#}
{#       });#}
{#       //$('input').attr("value",""); //删除form表单的信息#}
{#       //$('input[name="csrfmiddlewaretoken"]').attr("value","{{csrf_token}}"); //#}
{#       var url= "{% url "game_operation" %}?option="+func+"&r="+Math.random();#}
{#       for (var i=0;i<chk_value.length;i++){#}
{#           sid=chk_value[i];#}
{#           postdata={serverid:sid,csrfmiddlewaretoken:"{{csrf_token}}"};#}
{#            ajax_get(url,sid,0,6,postdata,action);#}
{#       }#}
{#    }#}
{##}
{#$(document).ready(function() {#}
{#    $.ajaxSetup({#}
{#                layerIndex:-1,#}
{#                beforeSend: function () {#}
{#                    this.layerIndex = layer.load(0, { shade: [0.5, '#393D49'] });#}
{#                },#}
{#                complete: function () {#}
{#                    layer.close(this.layerIndex);#}
{#                },#}
{#                error: function () {#}
{#                    layer.alert('部分数据加载失败，可能会导致页面显示异常，请刷新后重试', {#}
{#                        skin: 'layui-layer-molv'#}
{#                       , closeBtn: 0#}
{#                       , shift: 4 //动画类型#}
{#                    });#}
{#                }#}
{#            });#}
{##}
{##}
{#    //window.onload=onload;#}
{#    $('input[name="game_id"]').change(function() {#}
{#        var game_id=$(this).val();#}
{#        var game_dbname='game_'+game_id;#}
{#        var log_dbname="log_"+game_id;#}
{#        var game_db_dbname='game_bg_'+game_id;#}
{#        $('input[name="game_dbname"]').attr("value",game_dbname);#}
{#        $('input[name="log_dbname"]').attr("value",log_dbname);#}
{#        $('input[name="game_db_dbname"]').attr("value",game_db_dbname);#}
{#        /* Act on the event */#}
{#    });#}
{##}
{##}
{#    $("#all").click(function(){#}
{#        if(this.checked){#}
{#            $("[name=check_box]:checkbox").prop("checked", true);#}
{#        }else{#}
{#            $("[name=check_box]:checkbox").removeAttr("checked");#}
{#        }#}
{#     });#}
{##}
{#});#}
{#    </script>#}
{#        {% endblock %}#}
